package com.aaa.system.controller.api;

import com.aaa.entity.Menu;
import com.aaa.system.service.MenuService;
import com.aaa.utils.JwtUtils;
import com.aaa.utils.WebUtil;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: aaa-his-parent
 * @description:
 * @author: 闫克起2
 * @create: 2023-12-08 11:12
 **/
@RestController
@RequestMapping("system/api/menu")
public class ApiMenuController {

    @Autowired
    private MenuService menuService;

    @GetMapping("/leftMenu")
    public Result<List<Menu>> letfMenu(){
        String token = WebUtil.getRequest().getHeader("token");
        String phone = JwtUtils.getClaimByName(token);
        List<Menu> leftMenu = menuService.findLeftMenu(phone);
        return new Result<>(200,"查询左侧菜单成功",leftMenu);
    }
}
